From 462444ee9dc34cdf0220fee41c03d7dd0f258df3 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 15 Dec 2002 23:05:07 +0000 Subject: [PATCH] Correctly parse lat/lon from magellan track messasges. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@206 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/magproto.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gpsbabel/magproto.c b/gpsbabel/magproto.c index af0396e25..e9a252c25 100644 --- a/gpsbabel/magproto.c +++ b/gpsbabel/magproto.c @@ -36,6 +36,7 @@ extern gpsdata_type objective; static char * termread(char *ibuf, int size); static void termwrite(char *obuf, int size); +static double mag2degrees(double mag_val); typedef enum { mrs_handoff = 0, @@ -753,8 +754,12 @@ mag_trkparse(char *trkmsg) */ waypt->creation_time = mktime(&tm); - waypt->position.latitude.degrees = latdeg / 100.0; - waypt->position.longitude.degrees = lngdeg / 100.0; + if (latdir == 'S') latdeg = -latdeg; + waypt->position.latitude.degrees = mag2degrees(latdeg); + + if (lngdir == 'W') lngdeg = -lngdeg; + waypt->position.longitude.degrees = mag2degrees(lngdeg); + waypt->position.altitude.altitude_meters = alt; return waypt; -- 2.30.2